//Erik Wright
//conrot_servo.h

/*
This header file describes the relationship between the pwm_servo class
and this conrot_servo class.  Being a child, conrot_servo is derived
from the pwm_servo class.  It mainly exists to provide routines specific 
to calculating the distance of string let out by different commands.
*/


#include "pwm_servo.h"

#define Pi 3.141592654
#define Radius 1.5	//radius of spool
#define Pi_R (Pi*Radius)	//Pi*Radius
#define Pi_R1200 (Pi*Radius/1200)	//Pi*R/1200
#define Pi_R600 (Pi*Radius/600)		//Pi*R/600
#define five_halfs_Pi_R (5*Pi_R/2)

class conrot_servo : public pwm_servo
{
	private:
		float present_velo;	//current velocity
		float present_disp;	//current displacement
		float t_max;	//timescan variable
		double disp(double t_i, double t_f, int pw_i, int pw_f, double init_disp, double t);
		double velo(double t_i, double t_f, int pw_i, int pw_f, double t);	
		

	public:
		~conrot_servo();	//class destructor
		conrot_servo();		//default constructuor
		conrot_servo(const conrot_servo&);	//copy constructor
		
		float velo_at_t(float desired_time);	//calculate the velocity at t
		float disp_at_t(float desired_time);	//calculate the displacement at t
		void print_disp(float, char*);	//print to a csv file
		void print_velo(float, char*);	//print to a csv file
		void display_disp();	//displays present disp
		void display_velo();	//displays present velo
		float find_t_max();	//recalculates t_max
};
